<%@ page  language="java" contentType="text/html; charset=UTF-8"  pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%String path=request.getContextPath(); %>
<html>
<head>
    <title>影片管理页面</title>
    <%@ include file="../comm.jsp" %>
    <script src="${pageContext.request.contextPath}/js/tooljs/film.js"></script>
    <style>
        .layui-form{
            margin-left: 20px;
        }
        #add {
            margin-left: 50px;
        }
        .list{
            margin-top: 40px;
        }
        .layui-table{
            width: 95%;
            margin: 0 auto;
        }
        #demo7{
            margin-top: 10px;
            margin-left: 50px;
        }
        .layui-form-checkbox span{
            height: 20px;
        }
    </style>
</head>
<body>
<h2 align="center" style="margin-bottom:20px;">影片管理</h2>
<%--操作栏--%>
<section>
    <%--查询操作栏--%>
    <form onsubmit="" class="layui-form" id="selectForm">
        <%--名称查询框--%>
        <div class="layui-inline">
            <label class="layui-form-label">影片名称：</label>
            <div class="layui-input-inline" style="width: 100px;">
                <input type="text" id="filmName1"  class="layui-input" value="${requestScope.filmPageVO.params.filmName}">
            </div>
        </div>
        <%--国家下拉列表--%>
        <div class="layui-inline">
            <label class="layui-form-label">国家</label>
            <div class="layui-input-inline">
                <select name="country1" lay-verify="required" lay-search="" id="country1" lay-filter="country1">
                    <option value="">请选择国家</option>
                    <c:forEach var="country" items="${requestScope.filmPageVO.countryList}">
                        <option value="${country.countryCode}">${country.countryName}</option>
                    </c:forEach>
                </select>
            </div>
        </div>
        <%--影片类型下拉列表--%>
        <div class="layui-inline">
            <label class="layui-form-label">类型</label>
            <div class="layui-input-inline">
                <select name="type1" lay-verify="required" lay-search="" lay-filter="type1" id="type1">
                    <option value="">请选择类型</option>
                    <c:forEach var="type" items="${requestScope.filmPageVO.typeList}">
                        <option value="${type.ftcode}">${type.ftname}</option>
                    </c:forEach>
                </select>
            </div>
        </div>
        <%--语言下拉列表--%>
        <div class="layui-inline">
            <label class="layui-form-label">语言</label>
            <div class="layui-input-inline">
                <select name="language1" lay-verify="required" lay-search="" lay-filter="language1" id="language1">
                    <option value="">请选择语言</option>
                    <c:forEach var="language" items="${requestScope.filmPageVO.languageList}">
                        <option value="${language.lcode}">${language.lname}</option>
                    </c:forEach>
                </select>
            </div>
        </div>
        <%-- 查询操作--%>
        <hr>
        <button onclick="toFind(1,${requestScope.filmPageVO.rows})" type="button" class="layui-btn layui-btn-primary layui-border-blue">
            <i class="layui-icon">&#xe615;</i>    查询
        </button>
        <button onclick="toClearFind(1,${requestScope.filmPageVO.rows})" type="button" class="layui-btn layui-btn-primary layui-border-blue">
            <i class="layui-icon">&#xe9aa;</i>    清空查询
        </button>
        <button onclick="toAdd()" type="button" class="layui-btn layui-btn-primary layui-border-green">
            <i class="layui-icon">&#xe61f;</i>    新建
        </button>
        </div>
    </form>
</section>
<%--影片列表--%>
<section class="list">
    <table class="layui-table" lay-skin="line">
        <colgroup>
            <col width="100">
            <col width="100">
            <col width="100">
            <col width="200">
            <col width="100">
            <col width="100">
            <col width="150">
            <col width="150">
        </colgroup>
        <thead>
        <tr>
            <th>影片名称</th>
            <th>影片导演</th>
            <th>影片语言</th>
            <th>影片类型</th>
            <th>国家</th>
            <th>时长</th>
            <th>上映时间</th>
            <th>操作栏</th>
        </tr>
        </thead>
        <tbody>
        <c:forEach var="film" items="${requestScope.filmPageVO.filmList}">
            <tr>
                <td>${film.film_name}</td>
                <td>${film.director}</td>
                <td>${film.languageName}</td>
                <td>${film.filmTypeName}</td>
                <td>${film.countryName}</td>
                <td>${film.length}分钟</td>
                <td>${film.play_time}</td>
                <td>
                    <button onclick="toSet(${film.film_id})" class="layui-btn layui-btn-primary layui-border-orange  layui-btn-sm">
                        <i class="layui-icon">&#xe642;</i>    编辑
                    </button>
                    <button onclick="toDelete(${film.film_id})" class="layui-btn layui-btn-primary layui-border-red  layui-btn-sm">
                        <i class="layui-icon">&#xe640;</i>    删除
                    </button>
                </td>
            </tr>
        </c:forEach>
        </tbody>
    </table>
    <div id="demo7"></div>
</section>
<%@include file="filmAdd.jsp"%>
<%@ include file="filmSet.jsp"%>
<script>
    var $;
    layui.use(['jquery','laypage','form'], function() {
        $ = layui.$ ;
        var laypage = layui.laypage
            ,form = layui.form;
        laypage.render({
            elem: 'demo7'
            , count: ${requestScope.filmPageVO.total}
            , limit:${requestScope.filmPageVO.rows}
            , curr:${requestScope.filmPageVO.pageNo}
            , layout: ['count', 'prev', 'page', 'next', 'limit', 'skip']
            , limits:[4,10,16,25]
            , jump: function (obj,first) {
                if(first){
                    return;
                }
                toFind(obj.curr,obj.limit);
            }
        });
        //渲染查询条件
        $(function (){
            $('#country1').val("${empty requestScope.filmPageVO.params.countryCode?"":requestScope.filmPageVO.params.countryCode}");
            $('#language1').val("${empty requestScope.filmPageVO.params.languageCode?"":requestScope.filmPageVO.params.languageCode}");
            $('#type1').val("${empty requestScope.filmPageVO.params.typeCode?"":requestScope.filmPageVO.params.typeCode}");
            layui.form.render("select");
        })
    });
</script>
</body>
</html>